﻿using System;
using System.Collections.Generic;
using System.Text;
using JsonSharp.Values;
using Barbar.MapReport.HtmlRender.Handlers;
using JsonSharp.Collections;
using Barbar.MapReport.HtmlRender.Operations;

namespace Barbar.MapReport.HtmlRender {
  internal abstract class RenderBaseOperation {
    public void Render(RenderingContext context) {
      IServerCallbackOperation callbackOperation = this as IServerCallbackOperation;
      if (callbackOperation != null) {
        context.WriteCallbackOperation(callbackOperation);
      }
      ILegendOperation legendOperation = this as ILegendOperation;
      if (legendOperation != null) {
        context.AddLegendElement(legendOperation);
      }
      RenderInternal(context);
    }
    
    protected abstract void RenderInternal(RenderingContext context);
  }
}
